package com.ef.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ef.constant.StatusType;

@Entity
public class Course implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Enumerated(value = EnumType.STRING)
	private StatusType status = StatusType.VALID;

	@Column(length = 200)
	private String name;
	@Column(length = 200)
	private String term;
 
	private Double price;
	
	private Boolean hasNetCourse=false;

	/**
	 * 原始的类型的name
	 */
	@Column(length = 200)
	private String sourceType;

	private Integer monthCount;
	@ManyToMany(cascade = { CascadeType.ALL })
	private List<ClassUnit> classUnits;

	@ManyToOne(fetch = FetchType.LAZY)
	private User updateUser;

	@Temporal(TemporalType.TIMESTAMP)
	private Date updateTime;
	
	public List<ClassUnit> getClassUnits() {
		return classUnits;
	}

	public void setClassUnits(List<ClassUnit> classUnits) {
		this.classUnits = classUnits;
	}

	@Column(length = 500)
	private String comments;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTerm() {
		return term;
	}

	public void setTerm(String term) {
		this.term = term;
	}

 	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public StatusType getStatus() {
		return status;
	}

	public void setStatus(StatusType status) {
		this.status = status;
	}

	public Boolean getHasNetCourse() {
		return hasNetCourse;
	}

	public void setHasNetCourse(Boolean hasNetCourse) {
		this.hasNetCourse = hasNetCourse;
	}

	public User getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(User updateUser) {
		this.updateUser = updateUser;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getMonthCount() {
		return monthCount;
	}

	public void setMonthCount(Integer monthCount) {
		this.monthCount = monthCount;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Double getPrice() {
		return price;
	}
}
